package com.xuanwu.shop.other;

import java.util.Date;

import org.junit.Assert;
import org.junit.Test;

import com.xuanwu.shop.entity.Customer;
import com.xuanwu.shop.service.CustomerServiceInterface;
import com.xuanwu.shop.service.impl.CustomerServiceImp;
import com.xuanwu.shop.util.StringUtil;

public class CustomerTest {

	CustomerServiceInterface service = new CustomerServiceImp();
	
	@Test
	public void testLogin(){
		Assert.assertNotNull(service.login("zhang1314", "zhang"));
	}
	
	@Test
	public void testGetById(){
		Assert.assertNotNull(service.getById("20160319142645879391"));
	}
	
	@Test
	public void testRegister(){
		Customer customer = new Customer();
		customer.setEmail("962333959@qq.com");
		customer.setGender(1);
		customer.setId(StringUtil.createId(new Date()));
		customer.setPasswd("zhang");
		customer.setPhone("15300000220");
		customer.setRealName("张先森");
		customer.setUname("zhang1314");
		Assert.assertTrue(service.register(customer));
	}
}
